<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<!DOCTYPE html>
<html lang="zh-CN">
    <head> 
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <%@ include file="/WEB-INF/views/include/head.jsp"%>
    <link rel="stylesheet" href="${ctxStatic}/css/common_erp.css">
    <link rel="stylesheet" href="${ctxStatic}/css/list.css">
   <%--  <script src="${ctxStatic}/jquery/jquery-1.9.1.min.js"></script> --%>
   <script src="${ctxStatic}/js/jquery-1.9.1.min.js"></script>
    <script src="${ctxStatic}/js/layer.js"></script>
    <script src="${ctxStatic}/js/style.js"></script>
    <script src="${ctxStatic}/dateCalendar/WdatePicker.js"></script>
    <script>
	$(function(){
		
		searchListForm();
		
        $(".tabBox ul li").each(function(){
            var index=$(this).index();

            $(".tabBox ul li").eq(0).addClass("active");

            $(this).click(function(){

                $(this).addClass("active").siblings().removeClass("active");
                
                $("#tabPageStatus").val($(this).val());
                searchListForm();

                $(".tabBoxSm > .tabSm").eq(index).stop(true).show().siblings().stop(true).hide();
				
				var tableW = $(".tabBoxSm > .tabSm").eq(index).find('.tableHead').width();
				var tabodyH = $(".tabBoxSm > .tabSm").eq(index).find('.tableBody').height();
				var tableScrollH = $(".tabBoxSm > .tabSm").eq(index).find('.tableScroll').height();
				if(tabodyH>tableScrollH){
					$(".tabBoxSm > .tabSm").eq(index).find('.tableScroll').css('width',tableW + 18 + 'px')
				}else{
					$(".tabBoxSm > .tabSm").eq(index).find('.tableScroll').css('width','inherit')
				}

            })

        })

    });
	
	// 检索方法
	function searchListForm() {
		var params = $("#searchForm").serialize();
		$("#activity_pane").showLoading();
		$.post("${ctx}/inventory/request/searchList",params,function(result) {
					var listHtml = result["inventoryRequest"];
					var pageHtml = result["page"];
					$("#listHtml").html(listHtml);
					$("#paging").html(pageHtml);
					
					var length = $("p.needRED").length;
					for (var i = 0; i < length; i++) {
						var statusVal = $(".needRED")[i].innerHTML;
						if (statusVal=="<spring:message code="inventory_request_status_no" />") {
							$("p.needRED")[i].style.cssText="color:red;";
						}
					}
					$("#activity_pane").hideLoading();
				}, 'json');
	}
	
	// 重置方法
	function clearParam() {
		$("#venderName").val("");
		$("#dateFrom").val("");
		$("#dateTo").val("");
		searchListForm();
	}
	
    $(document).keydown(function(event){
    	if(event.keyCode == 13){
    		searchListForm();
    	}
    }); 
    </script>
</head>
<body>
<form id="searchForm" method="post">
<div class="listArea" id="activity_pane">
	<div class="listBg">
        <div class="searchArea clearfix">
            <div class="searchLeft clearfix" style="width: 900px;">
                <div class="searchInp clearfix">
                    <!-- 客户名称 -->
                    <p><spring:message code="inventory_request_list_search_customerName"/></p>
                    <input type="text" class="w-styleNub" id="venderName" name="venderName">
                </div>
                <div class="searchInp clearfix">
                    <!-- 日期 -->
                    <p><spring:message code="inventory_request_list_search_date"/></p>
                    <div class="timeBox">
                        <input type="text" class="laydate-icon" id="dateFrom" name="dateFrom" style="width: 110px" onclick="WdatePicker({el:this,dateFmt:'yyyy-MM-dd',onpicked:null})">
						<p class="list">~</p>
						<input type="text" class="laydate-icon" id="dateTo" name="dateTo" style="width: 110px" onclick="WdatePicker({el:this,dateFmt:'yyyy-MM-dd',onpicked:null})">
                    </div>        
                </div>
            </div>
            <div class="searchRight clearfix">
            	<!-- 入出库导入 -->
		        <button type="button" class="btn-js"  onclick="popup('500px','150px','${ctx}/material/stock/uploadExcel');"><spring:message code="material_inoutboundImport"/></button>
                <button type="button" onclick="searchListForm();"><spring:message code="commom_check"/></button>
                <button type="button" onclick = "clearParam()"><spring:message code="common_reset" /></button>
                <shiro:hasPermission name="inventory:request:edit">
                <button type="button" onclick="popup('1200px','610px','${ctx}/inventory/request/form')"><spring:message code="common_create" /></button>
                </shiro:hasPermission>
            </div>
        </div>
    </div>
    <input type="hidden" id="tabPageStatus" name="tabPageStatus" value="0"/>
    <div class="tabBox">
        <ul class="clearfix">
            <!-- 全部 -->
            <li class="active" value="0"><spring:message code="inventory_request_list_tab_all"/></li>
            <!-- 待入库 -->
            <li value="1"><spring:message code="inventory_request_list_tab_wait"/></li>
            <!-- 已入库 -->
            <li value="2"><spring:message code="inventory_request_list_tab_done"/></li>
        </ul>
	</div>
     <div class="listBg tabPadding overflowX">
        <div class="tableArea tabBoxSm">
            <div class="tableScrollSm" style = "height:650px;overflow: auto;width: 1264px;">
                <table cellpadding="0" class="tableHead" >
                    <thead>
                    <tr>
                        <!-- No. -->
                        <th><p class="table-No"><spring:message code="inventory_request_list_no"/></p></th>
                        <!-- 入库申请单号 -->
                        <th><p class="width-180px"><spring:message code="inventory_request_list_requestNo"/></p></th>
                        <!-- 入库类别 -->
                        <th><p class="width-100px"><spring:message code="inventory_request_list_inventoryCategory"/></p></th>
                        <!-- 客户名称 -->
                        <th><p class="width-180px"><spring:message code="inventory_request_list_venderName"/></p></th>
                        <!-- 客户品牌 -->
                        <th><p class="width-125px"><spring:message code="inventory_request_list_brand"/></p></th>
                        <!-- 入库状态 -->
                        <th><p class="width-100px"><spring:message code="inventory_request_list_iventoryStatus"/></p></th>
                        <!-- 申请入库数量 -->
                        <th><p class="width-100px"><spring:message code="inventory_request_list_requestQuantity"/></p></th>
                        <!-- 已入库数量 -->
                        <th><p class="width-100px"><spring:message code="inventory_request_list_realQuantity"/></p></th>
                        <!-- 未入库数量 -->
                        <th><p class="width-100px"><spring:message code="inventory_request_list_residueQuantity"/></p></th>
                        <!-- 申请人员 -->
                        <th><p class="width-100px"><spring:message code="inventory_request_list_requestUser"/></p></th>
                        <!-- 申请日期 -->
                        <th><p class="width-100px"><spring:message code="inventory_request_list_requestDate"/></p></th>
                    </tr>
                    </thead>
                </table>
                <table cellpadding="0" class="tableBody">
					<tbody id="listHtml">
					</tbody>
                </table>
            </div>
        </div>
    </div>
    <div id="paging"></div>
    </div>
</form>
</body>
</html>